﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ScriptEditor.Commands
{
    class Command_Music : Command
    {
        public string name
        {
            get
            {
                return Value1;
            }
            set
            {
                Value1 = value;
            }
        }
        public float musicVolume
        {
            get
            { 
                return float.TryParse(Value2, out float result) ? result : 0.5f;
            }
            set
            {
                Value2 = value.ToString();
            }
        }
        public bool loop
        {
            get
            {
                return bool.TryParse(Value3, out bool result) ? result : true;
            }
            set
            {
                Value3 = value.ToString();
            }
        }
        public float duration
        {
            get
            {
                return float.TryParse(Value4, out float result) ? result : 1;
            }
            set
            {
                Value4 = value.ToString();
            }
        }
        public string cueSheet
        {
            get
            {
                return Value6;
            }
            set
            {
                Value6 = value.ToString();
            }
        }
        public Command_Music()
        {
            CommandType = COMMANDTYPE.Music;
            name = "请输入音乐名称";
            musicVolume = 0.5f;
            loop =true;
            duration = 1;
            cueSheet = "BGM";
        }
        public Command_Music(string Name, float MusicVolume, bool Loop, float Duration, string CueSheet)
        {
            CommandType = COMMANDTYPE.Music;
            name = Name;
            musicVolume = MusicVolume;
            loop = Loop;
            duration = Duration;
            cueSheet = CueSheet;
        }
        public override string ToString()
        {
            return CommandType.ToString() + ":\n" + "播放音乐:" + name + " " + cueSheet;
        }
    }
}
